package com.lyz.dataStructure.algorithm.科大讯飞2020;/**
 * @Author:759057893@qq.com Lyz
 * @Date: ${Date} 10:26
 * @Description:
 **/

import java.util.Scanner;

/**
 *@Author:759057893@qq.com Lyz
 *@Date: 2019/9/12 10:26
 *@Description:
 **/
public class 压缩字符串 {

    public static String strCompress(String str){
        boolean flag=false;
        if(str==null||str.isEmpty()) {
            return null;
        } else {
            char test=str.charAt(0);
            StringBuffer mystr=new StringBuffer();
            int count=1;
            for(int i=1;i<str.length();i++) {
                if(test==str.charAt(i))
                    count++;
                else {
                    mystr.append(test);
                    if(count>1)
                    {
                        mystr.append(count);
                        flag=true;
                    }
                    test=str.charAt(i);
                    count=1;

                }
            }
            mystr.append(test);
            if(count>1)
            {
                mystr.append(count);
                flag=true;
            }
            if(flag) {
                return mystr.toString();
            } else {
                return str;
            }
        }


    }

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String s=sc.nextLine();
        System.out.println(strCompress(s));

    }
}
